{% extends 'admin-v2/layout.html.twig' %}

{% do script(['libs/jquery-validation.js','app/js/admin-v2/operating/goods-setting/index.js']) %}

{% set menu = 'admin_v2_goods_setting' %}

{% block main %}
  {{ web_macro.flash_messages() }}

  <form class="form-horizontal" id="goods-setting-form">
    <fieldset>
      <legend>{{ 'admin_v2.operating.goods_recommend_setting'|trans }}</legend>
      <div class="form-group">
        <div class="col-md-3 control-label">
          <label>{{ 'admin_v2.operating.goods_recommend_rule'|trans }}</label>
        </div>
        <div class="js-recommend-rule controls col-md-8 radios">
          {{ radios('recommend_rule', {
            'hot':'admin_v2.operating.goods_recommend.hot'|trans,
            'latest':'admin_v2.operating.goods_recommend.latest'|trans,
            'label':'admin_v2.operating.goods_recommend.label'|trans
          }, setting.recommend_rule|default('hot')) }}
          <div class="help-block js-recommend-rule-hot {% if setting.recommend_rule|default('hot') != 'hot' %}hidden{% endif %}">
            <span class="">{{ 'admin_v2.operating.goods_recommend.hot_tips'|trans }}</span>
          </div>
          <div class="help-block js-recommend-rule-latest {% if setting.recommend_rule|default('hot') != 'latest' %}hidden{% endif %}">
            <span class="">{{ 'admin_v2.operating.goods_recommend.latest_tips'|trans }}</span>
          </div>
          <div class="help-block js-recommend-rule-label {% if setting.recommend_rule|default('hot') != 'label' %}hidden{% endif %}">
            <span class="">{{ 'admin_v2.operating.goods_recommend.label_tips'|trans }}</span>
          </div>
        </div>
      </div>
    </fieldset>

    <fieldset>
      <legend>{{ 'admin_v2.operating.goods_show_setting'|trans }}</legend>
      <div class="form-group">
        <div class="col-md-3 control-label">
          <label>{{ 'admin_v2.operating.goods_show_data'|trans }}</label>
        </div>
        <div class="controls col-md-8 radios">
          {{ radios('show_number_data', {
            'join':'admin_v2.operating.goods_show.join_number'|trans,
            'visitor':'admin_v2.operating.goods_show.visitor_number'|trans,
            'none': 'admin_v2.operating.goods_show.none'|trans,
          }, setting.show_number_data|default('join')) }}
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-3 control-label">
          <label>{{ 'admin_v2.operating.goods_show_studen.review.data'|trans }}</label>
        </div>
        <div class="controls col-md-8 radios">
          {{ radios('show_student_review_num_enable', {
            '1':'form.radio_btn.open'|trans,
            '0':'form.radio_btn.close'|trans,
          }, setting.show_student_review_num_enable|default('1')) }}
        </div>
      </div>
    </fieldset>

{#    <fieldset>#}
{#      <legend>{{ 'admin_v2.operating.review_setting'|trans }}</legend>#}
{#      <div class="form-group">#}
{#        <div class="col-md-3 control-label">#}
{#          <label>{{ 'admin_v2.operating.review_show'|trans }}</label>#}
{#        </div>#}
{#        <div class="controls col-md-8 radios">#}
{#          {{ radios('show_review', {#}
{#            '1':'form.radio_btn.open'|trans,#}
{#            '0':'form.radio_btn.close'|trans,#}
{#          }, setting.show_review|default('1')) }}#}
{#        </div>#}
{#      </div>#}
{#    </fieldset>#}

    <fieldset>
      <legend>{{ 'admin_v2.operating.goods_leading_setting'|trans }}</legend>
      <div class="form-group">
        <div class="col-md-3 control-label">
          <label>{{ 'admin_v2.operating.goods_leading.join_group'|trans }}</label>
        </div>
        <div class="controls col-md-8 radios">
          {{ radios('leading_join_enabled', {
            '1':'form.radio_btn.open'|trans,
            '0':'form.radio_btn.close'|trans,
          }, setting.leading_join_enabled|default('0')) }}
          <div class="help-block">
            {{ 'admin_v2.operating.goods_leading.join_group.tips'|trans }}
            {#            <a href="#">{{ 'admin_v2.operating.goods_leading.join_group.btn'|trans }}</a>#}
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-3 control-label">
          <label for="leading-label">{{ 'admin_v2.operating.goods_leading.join_group_label'|trans }}</label>
        </div>
        <div class="controls col-md-3">
          <input class="form-control" id="leading-label" type="text" name="leading[label]"
                 value="{{ setting.leading.label|default('') }}">
          <div class="help-block">
            {#            <a href="#">{{ 'admin_v2.operating.goods_leading.join_group_label.example_btn'|trans }}</a>#}
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-3 control-label">
          <label
            for="leading-description">{{ 'admin_v2.operating.goods_leading.label_content.description'|trans }}</label>
        </div>
        <div class="controls col-md-8">
          <input class="form-control" type="text" name="leading[description]" id="leading-description"
                 value="{{ setting.leading.description|default('') }}">
          <div class="help-block">
            {{ 'admin_v2.operating.goods_leading.label_content.description_tips'|trans }}
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-3 control-label">
          <label for="leading-qrcode">{{ 'admin_v2.operating.goods_leading.label_content.qrcode'|trans }}</label>
        </div>
        <div class="controls col-md-8">
          <div class="cd-image-upload">
            <img src="{% if setting.leading.qrcode|default() %}{{ filepath(setting.leading.qrcode) }}{% endif %}"
                 alt=""
                 class="cd-avatar cd-avatar-square cd-avatar-lg" id="leading-qrcode"/>
            <div class="image-upload-mask">
              <div class="image-upload-content">
                <i
                  class="cd-icon cd-icon-camera"></i>{{ 'admin_v2.operating.goods_leading.label_content.qecode_upload'|trans }}
              </div>
            </div>
            <label class="image-upload-label">
              <input id="cd-upload" type="file" name="file" class="cd-hide" data-target="#leading-qrcode"
                     accept="{% if app.request.headers.get('User-Agent') matches '/MicroMessenger/' %}image/*{% else %}image/bmp,image/jpeg,image/png,image/jpg{% endif %}"
                     data-token="{{ upload_token('default', 'image') }}"/>
            </label>
          </div>
          <input id="leading-qrcode" type="hidden" name="leading[qrcode]"
                 value="{{ setting.leading.qrcode|default() }}"
                 class="form-control">
          <div class="help-block">
            {{ 'admin_v2.operating.goods_leading.label_content.qrcode_tips'|trans }}
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="col-md-offset-3 plm">
          {{ 'admin_v2.operating.goods_leading_setting.tips'|trans }}
        </div>
      </div>

    </fieldset>

    <div class="form-group">
      <div class="col-md-3 control-label"></div>
      <div class="controls col-md-8">
        <a class="btn btn-primary js-setting-save-btn"
           data-loading-text="{{ 'form.btn.save.submiting'|trans }}">
          {{ 'form.btn.save'|trans }}
        </a>
      </div>
    </div>
  </form>

{% endblock %}
